#
# Makefile for G.726 codec plugin
#
# Copyright (C) 2004 Post Increment, All Rights Reserved
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
#
# The Original Code is Open H323 library.
#
# The Initial Developer of the Original Code is Post Increment
#
# Contributor(s): ______________________________________.
#
# $Log$
# Revision 1.4  2007/09/05 11:52:56  csoutheren
# Fix compilation on MacOSX
#
# Revision 1.3  2007/04/19 06:09:03  csoutheren
# Fixed plugin build system to use better detection for OSX
# Resolved 1636262 - Fix for audio plugins for OSX
#
# Revision 1.2  2006/08/01 13:06:48  rjongbloed
# Added a raft of unvalidated audio codecs from OpenH323 tree
#
# Revision 1.1.2.1  2006/07/22 13:42:48  rjongbloed
# Added more plug ins
#
# Revision 1.1.2.1  2006/05/08 13:49:57  rjongbloed
# Imported all the audio codec plug ins from OpenH323
#
# Revision 1.4  2006/02/09 23:43:22  csoutheren
# Removed lines included incorrectly via copy and paste
#
# Revision 1.3  2004/08/22 04:20:17  csoutheren
# Added -fPIC to build commands to fix problems on 64 bit platforms
# Thanks to Klaus Kaempf
#
# Revision 1.2  2004/06/24 23:33:16  csoutheren
# Changed Makefiles to ensure all plugins have correct suffix
#
# Revision 1.1  2004/05/10 11:28:57  csoutheren
# Added G.726 plugin
#
#
AC_PLUGIN_DIR=@AC_PLUGIN_DIR@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
target_os=@target_os@

SONAME	= g726
STDCCFLAGS += @STDCCFLAGS@ -fPIC

SRCDIR	= ./g726
OBJDIR	= ./obj
PLUGINDIR=../..

CC		=@CC@
CFLAGS          =@CFLAGS@
CXX		=@CXX@
LDSO		=@LDSO@
PLUGINEXT	=@PLUGINEXT@
STDCCFLAGS	=@STDCCFLAGS@
LDFLAGS		=@LDFLAGS@
EXTRACFLAGS     =-I$(PLUGINDIR)

SRCS	+= g726codec.c \
	   g711.c \
	   $(SRCDIR)/g726_16.c \
	   $(SRCDIR)/g726_24.c \
	   $(SRCDIR)/g726_32.c \
	   $(SRCDIR)/g726_40.c \
	   $(SRCDIR)/g72x.c 

vpath	%.o $(OBJDIR)
vpath	%.c $(SRCDIR)

ifeq ($(VERBOSE),)
Q_CC = @echo [CC] `echo $< | sed s^@OPALDIR@/^^` ;
Q_LD = @echo [LD] `echo $(PLUGIN) | sed s^@OPALDIR@/^^` ;
endif


$(OBJDIR)/%.o : %.c
	@mkdir -p $(OBJDIR) >/dev/null 2>&1
	$(Q_CC)$(CC) -I../../../include -I./g726 $(STDCCFLAGS) $(OPTCCFLAGS) $(EXTRACFLAGS) $(CFLAGS) -c $< -o $@

PLUGIN	= ./g726_audio_pwplugin.$(PLUGINEXT)

OBJECTS = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(notdir $(SRCS))))

$(PLUGIN): $(OBJECTS)

ifeq (solaris,$(findstring solaris,$(target_os)))

	$(Q_LD)$(CC) $(LDSO) $@ -o $@ $^ $(EXTRALIBS)
else	
	$(Q_LD)$(CC) $(LDSO) -o $@ $^ $(EXTRALIBS)

endif	

install:
	mkdir -p $(DESTDIR)$(libdir)/$(AC_PLUGIN_DIR)
	install $(PLUGIN) $(DESTDIR)$(libdir)/$(AC_PLUGIN_DIR)

uninstall:
	rm -f $(DESTDIR)$(libdir)/$(AC_PLUGIN_DIR)/$(PLUGIN)

clean:
	rm -f $(OBJECTS) $(PLUGIN)

###########################################
